// window.parent.location.hash = '#c=60071010';

import React, { Component } from 'react';

import './index.less';

import {
    high,
    toast
} from 'nc-lightapp-front';

import mockFn from '../mock';

import SearchModal from '../components/SearchModal';
import OnlyInfoModal from '../components/OnlyInfoModal';
import SwitchToDocModal from '../components/SwitchToDocModal';
import JobHisModal from '../components/JobHisModal';
import ReptObjModal from '../components/ReptObjModal';
import CreateUserModal from '../components/CreateUserModal';
import FileManager from '../components/Uploader';
import ExportModal from '../components/ExportModal';
import AddKeyPsnModal from '../components/AddKeyPsnModal';
import EditTreeNodeModal from '../components/EditTreeNodeModal';

import AddRefer from '../components/AddRefer';

// 公共的组件
import SortModal from '../../../public/components/SortModal';
import BatchAddSub from '../../../public/components/BatchAddSub';
import RosterModal from '../components/RosterModal';
import BatchEditModal from '../../../public/components/BatchEdit';


// 公用方法
import deepCopy from '../../../public/functions/deep-copy';


// 功能函数
import processTemplate from './functions/processTemplateData';
import renderPage from './functions/renderPage';
import getMainTableData from './functions/getMainTableData';
import handleTableSelect from './functions/handleTableSelect';
import selectTree from './functions/selectTree';
import toggleModal from './functions/toggleModalVisible';
import getSelectedField from './functions/getSelectedField';
import processEditPageTemplate from './functions/processEditPageTemplage';
import deleteSubTableRows from './functions/deleteSubTableRows';
import addSubTableRow from './functions/addSubTableRow';
import pasteSubTableRow from './functions/pasteSubTableRow';
import insertSubTableRow from './functions/insertSubTableRow';
import deleteMainTableRow from './functions/deleteMainTableRow';
import batchAddSub from './functions/batchAddSub';
import exportPhoto from './functions/exportPhoto';
import showHisJobModal from './functions/showHisJobModal';
import showReportTo from './functions/showReportTo';
import createUser from './functions/createUser';
import cancelEdit from './functions/cancelEdit';
import selectAll from './functions/selectAll';
import importPhotos from './functions/importPhotos';
import printPage from './functions/print';
import fileManager from './functions/fileManager';
import printOutput from './functions/printOutput';
import exportPsn from './functions/exportPsn';
import setButtonStatus2 from './functions/setButtonStatus2';
import getLeftTreeData from './functions/getLeftTreeData';
import selectTreeNode from './functions/selectTreeNode';
import addPerson from './functions/addPerson';

// request函数
import getModifyData from '../request-functions/getModifyData';
import refreshRequest from '../components/AddNewPage/request/refresh';

import language from '../language';
import checkDbClick from './functions/checkDbClick';

import StopModal from '../components/StopModal';

import pageIns from '../instant';

const mock = mockFn();

import {handleHash, getAppPageConfig} from '../../../../hrpub/common/utils/utils';

import CardView from '../../../../hrpub/common/components/card-view';
import WpsModal from 'src/hrpub/common/components/wpsPreModel';
const {PrintOutput} = high;

class EntryMng extends Component {
    constructor(props) {
        super(props);
        if (props.use) {
            props.use.form('bd_psndoc', 'hi_psnjob_h', 'batch_edit', 'batchAddSub', 'hi_psnorg_h', 'only_info_template', 'keypsngrp');
            props.use.table('sort', 'hi_psnjob_history', 'hi_psnjob_history_down');
            props.use.editTable('ncc60071025list');
            props.use.cardTable(...props.cardTableList);
            props.use.search('ncc60071025query');
        }
        this.config = getAppPageConfig();

        this.state = {
            humanResourceOrganizationValue: {}, // 人力资源选择的值，大概率只用refpk属性
            page: 'main', // main  add-new 当前是哪个页面
            searchModalVisible: false, // 查询弹窗的显示隐藏
            onlyInfoModalVisible: false, // 唯一性信息验证弹窗的显示隐藏
            departmentTreeData: [], // 左侧部门树的数据
            currentSelectDepartment: '', // 当前选中的部门
            searchModalValue: {}, // 存储查询弹窗的输入值
            queryOid: '',
            include_child_depts: true, // 包含下级部门人员
            include_child_orgs: false, // 显示历史成员
            sortModalVisible: false,
            pageInfo: {
                pageSize: 10,
                pageIndex: 0,
                total: 0,
                totalPage: 1
            },
            hasSearched: false, // true表示已经进行过一次正常查询
            selectedRows: [], // 选中的行
            selectedRowsWithHis: [],// 选中的行包含历史人员
            showTableCheckbox: true,
            switchToDocModalVisible: false,
            uniqueFields: '',
            addPageTemplate: {}, // 新增页面的模版填充数据数据, 从onlyinfomodal模块提交后返回更新
            batchEditModalVisible: false, // 批改弹窗显示/隐藏标志
            pageFrom: '', // 点击了哪个按钮转换的页面 add / modify
            batchAddSubVisible: false, // 批量添加子集弹窗的显示/隐藏标示
            copyData: {}, // 新增页面的表格，复制下来的数据, key值是表格的tableid
            show_all_info: false, // 显示所有信息
            show_on_job_psn: true, // 显示历史人员组
            rosterModalVisible: false, // 联查花名册弹窗
            mainTableData: {}, // 主表的数据
            leftTreeType: 'keyPsnGroup', // 左树的类型，管理范围(orgRange)/人员类别(psnType)
            reptObjVisible: false, // 汇报对象弹窗
            reptColumns: [], // 回报对象用到的数据
            reptData: [], // 汇报对象 用到的数据
            createUserModalVisible: false, // 生成用户弹窗
            imageData: '', // 头像的base64码
            subTableEditable: true, // 为true代表子表可以编辑
            include_cancle_dept: false, // 是否包含已撤销部门
            showUploader: false, // 附件管理显示隐藏
            printData: {
                filename: language['hi6007-000099'], /* 国际化处理： 员工信息*/
                funcode: '60071010',      //功能节点编码，即模板编码
                nodekey: '60071010list',
                oids: '',   // 单据pk  oids含有多个元素时为批量打印,
                outputType: 'output'
            }, // 输出的配置数据
            exportType: '', // 导出全部 all   导出 cur
            exportAllpks: [], //
            exportFilter: [], //
            fixTemplate: {}, // 最初的模版值
            allButtons: [], // 所有按钮
            clickRow: null, // 点击高亮的行数据
            showHistoryTable: false,
            disableUpload: false, // 禁止上传照片
            showAddModal: false, // 弹出新增弹窗
            addOid: '', // 新增弹窗是个查询组件，需要用到oid， 要从template里取
            editTreeNodeModalVisible: false, // 编辑左树节点弹窗显示隐藏
            currentEditTreeNodeData: {}, // 当前编辑的节点的初始化数据,
            currentEditNodeType: '', // 当前是新增节点还是修改节点
            disabledTreeNodeList: [], // 左树禁用节点的refpk
            addReferConfig: {}, // 新增参照的参数
            myTableStash: null, // myTable ncclist暂存
            stopModalVisible: false, // 终止弹窗组件显示隐藏
            mainTableHeight: 350, // 主表格的高度
            pageHeight: 0, // 整个页面 app的高度
        };

        this.updateState = this.updateState.bind(this);
        this.handleTableSelect = this.handleTableSelect.bind(this);
        this.getMainTableData = this.getMainTableData.bind(this);
        this.goBackToMainPage = this.goBackToMainPage.bind(this);
        this.getRef = this.getRef.bind(this);
        this.selectTree = this.selectTree.bind(this);
        this.toggleModal = this.toggleModal.bind(this);
        this.sortModalOnSure = this.sortModalOnSure.bind(this);
        this.copyRow = this.copyRow.bind(this);
        this.deleteRow = this.deleteRow.bind(this);
        this.pasteRow = this.pasteRow.bind(this);
        this.addRow = this.addRow.bind(this);
        this.toEditPage = this.toEditPage.bind(this);
        this.getModifyData = this.getModifyData.bind(this);
        this.processEditPageTemplate = this.processEditPageTemplate.bind(this);
        this.insertRow = this.insertRow.bind(this);
        this.deleteMainTableRow = this.deleteMainTableRow.bind(this);
        this.batchAddSub = this.batchAddSub.bind(this);
        this.toggleLeftTreeType = this.toggleLeftTreeType.bind(this);
        this.exportPhoto = this.exportPhoto.bind(this);
        this.showHisJobModal = this.showHisJobModal.bind(this);
        this.showReportTo = this.showReportTo.bind(this);
        this.createUser = this.createUser.bind(this);
        this.getMultiLanguage = this.getMultiLanguage.bind(this);
        this.cancelEdit = this.cancelEdit.bind(this);
        this.selectAll = this.selectAll.bind(this);
        this.importPhotos = this.importPhotos.bind(this);
        this.print = this.print.bind(this);
        this.fileManager = this.fileManager.bind(this);
        this.printOutput = this.printOutput.bind(this);
        this.addWebkitDirectory = this.addWebkitDirectory.bind(this);
        this.exportPsn = this.exportPsn.bind(this);
        this.setButtonStatus2 = this.setButtonStatus2.bind(this);
        this.checkDbClick = this.checkDbClick.bind(this);
        this.onLeftTreeCancelClick = this.onLeftTreeCancelClick.bind(this);
        this.setUpLoaderRef = this.setUpLoaderRef.bind(this);
        this.getLeftTreeData = this.getLeftTreeData.bind(this);
        this.selectTreeNode = this.selectTreeNode.bind(this);
        this.addPerson = this.addPerson.bind(this);
        this.doDisabledTreeNodeList = this.doDisabledTreeNodeList.bind(this);
        this.getPageHeight = this.getPageHeight.bind(this);
        this.previewCardView = this.previewCardView.bind(this);
        this.getCardViewRef = this.getCardViewRef.bind(this);
    }

    // 通过操作dom，展示禁用节点
    doDisabledTreeNodeList(nTreeData) {
        const {syncTree} = this.props;
        let leftTreeNode = document.getElementById('leftTreeList').querySelector('.u-tree-child-tree').querySelectorAll('li');
        let {disabledTreeNodeList} = this.state;
        let nDisList = [];

        let treeData = syncTree.getSyncTreeValue('keyPsnGroupTree');

        treeData[0].children.map((item, index) => {
            if(item.nodeData.nodeValue['enablestate'] === '3') {
                nDisList.push(item.refpk);
                leftTreeNode[index].className = leftTreeNode[index].className + ' self-disabled'
            }
            else {
                leftTreeNode[index].className = leftTreeNode[index].className.replace('self-disabled', '')
            }
        });

        this.setState({
            disabledTreeNodeList: nDisList
        });
    }

    // 点击新增
    addPerson() {
        addPerson.call(this);
    }

    // 选择一个左树节点
    selectTreeNode(value) {
        selectTreeNode.call(this, value);
    }

    // 获取左树数据
    getLeftTreeData() {
        getLeftTreeData.call(this);
    }

    // 设置上传照片的那个那个ref
    setUpLoaderRef(upload) {
        this.upload = upload;
        this.upload.setState({
            disableUpload: this.state.disableUpload
        });
    }

    // 如果点击了
    onLeftTreeCancelClick() {
        this.props.editTable.setTableData('ncc60071025list', {rows:[]}, false);
    }

    // 双击的时候检测是否可以预览
    checkDbClick(callback) {
        return checkDbClick.call(this, callback);
    }

    // 设置按钮状态
    setButtonStatus2(page) {
        setButtonStatus2.call(this, page);
    }

    // 输出
    printOutput() {
        printOutput.call(this);
    }

    // 附件管理
    fileManager() {
        fileManager.call(this);
    }

    // 打印
    print() {
        printPage.call(this);
    }

    // 导入照片
    importPhotos() {
        importPhotos.call(this);
    }

    // 生成用户
    createUser() {
        return createUser.call(this);
    }

    // 汇报对象
    showReportTo() {
        return showReportTo.call(this);
    }

    // 任职历史弹窗
    showHisJobModal() {
        return showHisJobModal.call(this);
    }

    // 导出照片
    exportPhoto() {
        return exportPhoto.call(this);
    }

    toggleLeftTreeType(type) {
        return () => {
            this.setState({
                leftTreeType: type
            });
            this.props.asyncTree.closeNodeByPkAsync('departmentTree');
        }
    }

    // 处理新增/修改页面初始化返回的模版数据
    processEditPageTemplate(res, cb) {
        processEditPageTemplate.call(this, res, cb);
    }

    // 获取修改页面数据
    async getModifyData(cb, pk_psnjob, refresh) {
        const {
            humanResourceOrganizationValue: {
                refpk
            },
            selectedRows,
            pageFrom
        } = this.state;

        let postData = {
            func_type: '4',
            pk_org: refpk,
            pk_psnjob: pk_psnjob ? pk_psnjob : selectedRows[0].data.values['pk_psnjob'].value
        };

        try {
            let res = null;

            if(refresh === 'refresh') {
                res = await refreshRequest(postData);
                if(res.success) {
                    this.setState({
                        addPageTemplate: {
                            ...this.state.addPageTemplate,
                            ...res.data
                        }
                    }, () => {
                        cb && cb.call(this);
                    });
                }
            }
            else {
                res = await getModifyData(postData, pageFrom);
                if(res.success) {
                    this.processEditPageTemplate(res, () => {
                        cb && cb.call(this);
                    });
                }
            }
        }
        catch(e) {
        }

    }

    // 跳转到新增/修改页面
    toEditPage(pageFrom, cb) {
        if(pageFrom === 'add') {
            this.setState({
                pageFrom: pageFrom,
                onlyInfoModalVisible: true,
                subTableEditable: true,
                disableUpload: false
            }, () => {
                cb && cb();
            });
        }
        else if(pageFrom === 'modify') {
            this.checkDbClick(() => {
                this.setState({
                    pageFrom: 'dbClick',
                    disableUpload: false
                }, () => {  
                    this.getModifyData(() => {
                        this.setState({
                            page: 'add-new',
                            subTableEditable: true,
                            disableUpload: false
                        }, () => {
                            cb && cb();
                        });
                        // 将按钮设置为修改页面的按钮
                        this.setButtonStatus2('addEditPage');
                    });
                });
            })
        }
        else if(pageFrom === 'dbClick') {
            this.setState({
                pageFrom: 'dbClick',
                disableUpload: true
            }, () => {
                this.getModifyData(() => {
                    this.setState({
                        page: 'add-new',
                        disableUpload: true
                    }, () => {
                        cb && cb();
                        this.cancelEdit();
                    });
                    const {selectedRows} = this.state;
                    if(selectedRows[0].data.values['pk_psndoc.ishiskeypsn'].value) {
                        this.setButtonStatus2();
                    }
                    else {
                        this.setButtonStatus2('addEditPage');
                    }
                });
            });
        }
    }

    // 选择左树
    selectTree(pk) {
        selectTree.call(this, pk)
    }

    // 主表选择
    handleTableSelect(props, moduleId, record, index) {
        handleTableSelect.call(this, props, moduleId, record, index);
    }

    // 通用更新state
    updateState(data, callback = () => { }) {
        this.setState(data, callback);
    }

    // 获取多语言
    getMultiLanguage() {
        return new Promise((resolve, reject) => {
            this.props.MultiInit.getMultiLang({
                moduleId: 'hi6007',
                domainName: 'hrhi',
                callback: (json, status, init) => {
                    Object.assign(language, json);
                    resolve();
                }
            });
        });
    }

    componentDidMount() {
        let { meta, button, templateData } = this.props;

        this.getMultiLanguage()
            .then(() => {
                // createUIDom(this.config, (data = {}) => {
                    let batchEdit = {};
                    let data = templateData;
                    data.button.map((item) => {
                        if(item.key === 'Edit') {
                            batchEdit = deepCopy(item.children[0].children[0]);
                        }
                    });
                    data.button.splice(1, 0, batchEdit);

                    this.setState({
                        context: data.context,
                        queryOid: data.template.ncc60071025query.oid,
                        fixTemplate: data.template,
                        allButtons: data.button,
                        addOid: data.template.multiadd.oid
                    });
        
                    Object.assign(data.template, mockFn().template);
        
                    meta.setMeta(processTemplate.call(this, data.template) || {}, () => {
                        console.log(meta.getMeta());
                    });
                    button.setButtons(data.button || {});
                    this.setButtonStatus2('init');
                    this.getPageHeight();
                    // 这个功能是只允许导入文件夹
                    // this.addWebkitDirectory();
                // });
            });
        
    }

    // 获取页面高度
    getPageHeight() {
        if(window.getComputedStyle) {
            let height = window.getComputedStyle(document.getElementById('app')).height.replace('px', '');

            this.setState({
                pageHeight: height
            });
        }
    }

    // 获取主表数据
    getMainTableData() {
        getMainTableData.call(this);
    }

    // 返回主表
    goBackToMainPage() {

        this.setState({
            page: 'main',
            selectedRows: this.props.editTable.getCheckedRows('ncc600704list')
        });
        this.getMainTableData();
        this.setButtonStatus2('mainTableHasData');

        // 因为批量添加子集出现了一个无法查找原因的错误，
        // 错误表现为，当经过新增/修改页面修改template之后，
        // 批量添加子集弹窗第二步会报非法调用错误，
        // 所以为了将就这个错误，在返回主表之后，会将template重置为第一次的template
        // 猜测是因为动用了ajax的某些值，导致了非法调用, 待验证
        this.props.meta.setMeta(this.state.fixTemplate);
    }

    // 获取组件的实例对象
    getRef(refName) {
        return this[refName];
    }
    
    // 切换各种弹窗显示隐藏，type为弹窗的显示隐藏state的key值
    toggleModal(type, visible) {
        return toggleModal.call(this, type, visible);
    }

    // 排序弹窗点击确定的回调
    sortModalOnSure() {
        if(this.state.hasSearched) {
            this.getMainTableData();
        }
    }

    // 根据选中的行，拿出需要的字段
    getSelectedField(field, all) {
        return getSelectedField.call(this, field, all);
    }

    // 新增页面的表格复制
    copyRow(tableId, data) {
        this.setState({
            copyData: {
                ...this.state.copyData,
                [tableId]: deepCopy(data)
            }
        }, () => {
            toast({
                color: 'success',
                content: language['hi6007-000173']/* 国际化处理： 复制成功*/
            });
        });
    }
    
    // 新增页面删除表格行
    deleteRow(tableId, indexList) {
        return deleteSubTableRows.call(this, tableId, indexList);
    }

    // 新增页面粘贴
    pasteRow(tableId, index) {
        return pasteSubTableRow.call(this, tableId, index);
    }

    // 新增页面新增加一行
    addRow(tableId, index, values = {}, focus = false) {
        return addSubTableRow.call(this, tableId, index, values = {}, focus = false);
    }

    // 新增页面插入一行
    insertRow(tableId, index) {
        return insertSubTableRow.call(this, tableId, index);
    }

    // 主表删除方法
    deleteMainTableRow() {
        return deleteMainTableRow.call(this);
    }

    // 触发批量添加子集功能
    batchAddSub() {
        return batchAddSub.call(this);
    }

    // 取消编辑，进入预览态
    cancelEdit() {
        cancelEdit.call(this);
    }

    // 点击全选按钮
    selectAll(props, tableId, status, length) {
        selectAll.call(this, status);
    }

    // 给导入照片的uploader的input添加允许传入文件夹
    addWebkitDirectory() {
        let oInput = document.querySelector('.import-photo-wrapper').querySelector('input[type="file"]');

        oInput.webkitdirectory = true;
    }

    // 导出和导出全部的点击
    exportPsn(type) {
        exportPsn.call(this, type);
    }

    // 联查卡片
    previewCardView() {
        let rows = this.props.editTable.getCheckedRows('ncc60071025list');

        // this.cardViewRef.openCardViewModal(rows);
        this.wpsview.openView(rows);
    }

    // 获取联查卡片实例
    getCardViewRef(ref) {
        this.wpsview = ref;
    }

    render() {

        const {
            searchModalVisible,
            onlyInfoModalVisible,
            queryOid,
            sortModalVisible,
            switchToDocModalVisible,
            humanResourceOrganizationValue,
            currentSelectDepartment,
            uniqueFields,
            batchEditModalVisible,
            selectedRows,
            batchAddSubVisible,
            include_child_depts,
            include_child_orgs,
            include_child_psncl,
            show_all_info,
            rosterModalVisible,
            show_on_job_psn,
            reptObjVisible,
            reptColumns,
            reptData,
            createUserModalVisible,
            showUploader,
            printData,
            exportType,
            exportFilter,
            exportAllpks,
            clickRow,
            showHistoryTable,
            showAddModal,
            addOid,
            editTreeNodeModalVisible,
            currentEditTreeNodeData,
            currentEditNodeType,
            disabledTreeNodeList,
            addReferConfig,
            stopModalVisible,
            selectedRowsWithHis
        } = this.state;

        const {
            meta,
            editTable,
            form
        } = this.props;

        const rosterPks = this.getSelectedField('pk_psnjob', true);

        return (
            <div 
                className="nc-bill-tree-table entry-mng-page"
                style={{
                    height: 'auto'
                }}
            >
                {renderPage.call(this)}
                <SearchModal
                    {...this.props}
                    updateState={this.updateState}
                    searchModalVisible={searchModalVisible}
                    getMainTableData={this.getMainTableData}
                />
                <OnlyInfoModal
                    {...this.props}
                    onlyInfoModalVisible={onlyInfoModalVisible}
                    updateState={this.updateState}
                    queryOid={queryOid}
                    humanResourceOrganizationValue={humanResourceOrganizationValue}
                    currentSelectDepartment={currentSelectDepartment}
                    uniqueFields={uniqueFields}
                    copyRow={this.copyRow}
                    deleteRow={this.deleteRow}
                    pasteRow={this.pasteRow}
                    addRow={this.addRow}
                    processEditPageTemplate={this.processEditPageTemplate}
                    setButtonStatus2={this.setButtonStatus2}
                />
                <SortModal
                    {...this.props}
                    visible={sortModalVisible}
                    onSure={this.sortModalOnSure}
                    onClose={this.toggleModal('sortModalVisible', false)}
                    templateId="sort"
                    func_type={4}
                />
                <SwitchToDocModal
                    {...this.props}
                    switchToDocModalVisible={switchToDocModalVisible}
                    updateState={this.updateState}
                    humanResourceOrganizationValue={humanResourceOrganizationValue}
                    getMainTableData={this.getMainTableData}
                />
                <BatchEditModal
                    {...this.props}
                    batchEditModalVisible={batchEditModalVisible}
                    updateState={this.updateState}
                    ref={ref => this.batchEdit = ref}
                    humanResourceOrganizationValue={humanResourceOrganizationValue}
                    selectedRows={selectedRows}
                    func_type={4}
                />
                <BatchAddSub
                    {...this.props}
                    meta={meta}
                    editTable={editTable}
                    form={form}
                    visible={batchAddSubVisible}
                    func_type={4}
                    param_str={this.getSelectedField('pk_psnjob').join(',')}
                    pk_org={humanResourceOrganizationValue.refpk}
                    onClose={() => {
                        this.setState({
                            batchAddSubVisible: false
                        });
                    }}
                />
                <RosterModal
                    {...this.props}
                    orgVal={humanResourceOrganizationValue}
                    queryOid={queryOid}
                    tree_node_id={currentSelectDepartment}
                    include_child_depts={include_child_depts}
                    include_child_orgs={include_child_orgs}
                    include_child_psncl={include_child_psncl}
                    show_all_info={show_all_info}
                    show_on_job_psn={show_on_job_psn}
                    visible={rosterModalVisible}
                    onClose={this.toggleModal('rosterModalVisible', false)}
                    rosterPks={rosterPks && rosterPks.join(',')}
                    func_type={4}
                />
                <JobHisModal {...this.props} showHistoryTable={showHistoryTable}/>
                <ReptObjModal
                    {...this.props}
                    visible={reptObjVisible}
                    columns={reptColumns}
                    data={reptData}
                    onClose={this.toggleModal('reptObjVisible', false)}
                />
                <CreateUserModal
                    {...this.props}
                    visible={createUserModalVisible}
                    onClose={this.toggleModal('createUserModalVisible', false)}
                    selectedRows={selectedRows}
                    humanResourceOrganizationValue={humanResourceOrganizationValue}
                    selectedRowsWithHis={selectedRowsWithHis}
                />
                {showUploader && <FileManager
                    json={language}
                    table={editTable}
                    onClose={this.toggleModal('showUploader', false)}
                    clickRow={clickRow}                
                />}
                <PrintOutput
                    ref={ref => this.printOutputRef = ref}
                    url={'/nccloud/hrhi/psndoc/PsndocTemplatePrintAction.do'}
                    data={printData}
                />
                <ExportModal
                    {...this.props}
                    orgVal={humanResourceOrganizationValue}
                    show_on_job_psn={show_on_job_psn}
                    exportType={exportType}
                    exportFilter={exportFilter}
                    exportAllpks={exportAllpks}
                />
                <AddKeyPsnModal
                    {...this.props}
                    visible={showAddModal}
                    addOid={addOid}
                    updateState={this.updateState}
                    getMainTableData={this.getMainTableData}
                />
                <EditTreeNodeModal
                    {...this.props}
                    visible={editTreeNodeModalVisible}
                    updateState={this.updateState}
                    currentEditTreeNodeData={currentEditTreeNodeData}
                    orgVal={humanResourceOrganizationValue}
                    currentEditNodeType={currentEditNodeType}
                    currentSelectDepartment={currentSelectDepartment}
                    getRef={this.getRef}
                />
                <AddRefer 
                    {...addReferConfig}
                />
                <StopModal
                    {...this.props}
                    currentSelectDepartment={currentSelectDepartment}
                    orgVal={humanResourceOrganizationValue}
                    ref={ref => this.stopModalRef = ref}
                    getMainTableData={this.getMainTableData}
                    stopModalVisible={stopModalVisible}
                    updateState={this.updateState}
                />
                {/* <CardView
                    {...this.props}
                    onRef={this.getCardViewRef}
                /> */}
                <WpsModal
                    {...this.props}
                    onRef ={this.getCardViewRef}
                    appcode={'60071025'}
                    pk_org={humanResourceOrganizationValue}
                   
                />
            </div>
        );
    }
}

export default handleHash('2019', 'c=60071025&p=60071025p')(EntryMng);
